<template>
  <div class="app">
     <!-- v-bind 或者 :属性  的作用   -->
<!-- 在绑定 prop 时，prop 必须在子组件中声明。可以用修饰符指定不同的绑定类型。 props 中， 父组件声明的属性名必须和子组件声明的prop属性名一致-->
    <ele-header :seller="seller"></ele-header>
    <div class="tab">
      <div class="tab-item">
        <router-link to="/goods">商品</router-link>
      </div>
      <div class="tab-item">
        <router-link to="/ratings">评价</router-link>
      </div>
      <div class="tab-item">
        <router-link to="/seller">商家</router-link>
      </div>
    </div>
    <keep-alive>
      <router-view :seller="seller"></router-view>
    </keep-alive>
  </div>
</template>

<script>
// 注册组件
import header from "./components/header/header.vue";

export default {
  name: "App",

  data() {
    return {
      seller: {},
    };
  },
  // 不允许用原生元素名作为组件名
  components: {
    "ele-header": header,
  },
  mounted() {
    this.$http
      .get("/api2/seller")
      .then((response) => (
        console.log(response),
        console.log(response.body.data),
        this.seller = response.body.data       // response.json(),
        ));
  }
};
</script>


<style lang='stylus' rel="stylesheet/stylus">
@import "./common/stylus/mixins.styl"
// 声明样式为 stylus，则不会报错
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}

.app {
  .tab {
    display: flex
    justify-content: space-around
     border-1px(rgba(7, 17, 27, 0.1))
    //border-bottom: 1px solid 
    // background-color red
    width: 100%
    line-height: 40px
    align-items: center

    .tab-item {
      text-align: center;
      flex: 1;

      // & 标识嵌套的上一层级
      & > a {
        display: block;
        text-decoration: none;
        font-size: 14px;
        font-color: rgb(77, 85, 93);
      }

      a.active {
        color: yellow;
      }
    }
  }
}

// /* flex 布局 */
// .app .tab {
// display: flex;
// justify-content: space-around;
// }
.tab-item {
  text-decoration-line: none;
}
</style>
